package cn.iocoder.yudao.framework.business.evaluation.enums;

import cn.iocoder.yudao.framework.business.basic.enums.EnumValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 评分类型枚举
 *
 * @author 山野羡民
 * @since 2024/4/5 7:56
 */
@Getter
@AllArgsConstructor
public enum ScoreTypeEnum implements EnumValuable {

    ALL(0, "全部"),
    POSITIVE(1, "好评"),
    NEUTER(2, "中评"),
    NEGATIVE(3, "差评"),
    HAS_PICTURE(4, "有图"),
    ;

    private final Integer value;
    private final String name;

    public static ScoreTypeEnum valueOf(int value) {
        return Stream.of(ScoreTypeEnum.values())
                .filter(p -> p.value == value)
                .findAny()
                .orElse(ScoreTypeEnum.ALL);
    }

}
